Euler Problem 97

The first known prime found to exceed one million digits was discovered in 1999, and is a Mersenne prime of the form 26972593−1; it contains exactly 2,098,960 digits. Subsequently other Mersenne primes, of the form 2p−1, have been found which contain more digits.

However, in 2004 there was found a massive non-Mersenne prime which contains 2,357,207 digits: 28433 × 27830457 + 1.

Find the last ten digits of this prime number.


In [1]:
print ((28433 * pow(2, 7830457, 10**10) + 1) % 10**10)


8739992577

Note: Python makes this too easy. The largest prime number currently known (as of September 2014) is 257885161-1, which contains 174,251,702 digits. It was discovered in 2013. The largest known non-Mersenne prime (and the 11th largest known prime) is 19249 × 213018586 + 1, which was discovered in 2007 and contains 3,918,990 digits. See https://primes.utm.edu/primes/search.php?Number=100 for current records.


In [ ]: